<template>
	<div class="iframe-container">
		<iframe :src=xxlJobUrl width="100%" scrolling="auto" frameborder="0" class="frame"
		:style="{ 'height': documentHeight-50-20-3 + 'px'}">
		</iframe>
    </div>
</template>

<script>
  import {getXxlJobUrl} from '@/api/system/job/job.js'
	export default {
	  components: {
	  },
    data() {
    	return {
    		xxlJobUrl:''
    	}
    },
		mounted () {
		  this.resetDocumentHeight()
      this.getUrl()
		},
		methods:{
			//height: 899px;background-color: #FFFFFF;border-radius: 8px;margin: 10px;box-shadow: 2px 2px 5px #8C939D;
			// 重置窗口可视高度
			resetDocumentHeight () {
			  this.documentHeight = document.documentElement['clientHeight']
			  window.onresize = () => {
			    this.documentHeight = document.documentElement['clientHeight']
			  }
			},
			setStyle(){
				var height = this.documentHeight-50
				alert(height)
				return { height: height + 'px' }
			},
      getUrl(){
        getXxlJobUrl().then(data=>{
          if(data.code=="0000"){
            this.xxlJobUrl = data.data
          }else{
            this.$message.error(data.msg)
          }
        })
      }
		},
	  computed: {
	    sidebar() {
	      return this.$store.state.app.sidebar
	    },
			documentHeight: {
			  get () { return this.$store.state.app.documentHeight },
				set (val) { this.$store.commit('setDocumentHeight', val) }
			},
	  }
	}
</script>

<style>
</style>
